home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / haeberli / libgutil / objlib.c < prev    next >
C/C++ Source or Header  |  1994-08-01  |  15KB  |  755 lines

  1. /*
  2.  * Copyright 1991, 1992, 1993, 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. /*
  18.  *    obj -
  19.  *        Some utilities for reading a writing geometric objects. 
  20.  *
  21.  *                Paul Haeberli - 1985
  22.  */
  23. #include "obj.h"
  24.  
  25. static tokentofile();
  26. static tofile();
  27.  
  28. static int dowriteattrs;
  29. static int dowritebinary;
  30.  
  31. #define ATTR_TOKEN    0
  32. #define POINT_TOKEN    0
  33. #define LINE_TOKEN    1
  34. #define LOOP_TOKEN    2
  35. #define POLY_TOKEN    3
  36.  
  37. /*
  38.  *    fast point alloc and free
  39.  *
  40.  */
  41. #define NINCHUNK    100
  42.  
  43. static point *fpnts;
  44.  
  45. static point *pntmalloc()
  46. {
  47.     point *p;
  48.     int i;
  49.  
  50.     if(!fpnts) {
  51.            p = (point *)mymalloc(NINCHUNK*sizeof(point));
  52.         for(i=0; i<NINCHUNK; i++)
  53.         freepnt(p++);
  54.     }
  55.     p = fpnts;
  56.     fpnts = fpnts->next;
  57.     return p;
  58. }
  59.  
  60. freepnt(pnt)
  61. point *pnt;
  62. {
  63.    if( pnt ) {
  64.        pnt->next = fpnts;
  65.        fpnts = pnt;
  66.    }
  67. }
  68.  
  69. writeattrs(f)
  70. int f;
  71. {
  72.     dowriteattrs = f;
  73. }
  74.  
  75. writebinary(f)
  76. int f;
  77. {
  78.     dowritebinary = f;
  79. }
  80.  
  81. writeobj(outf,obj)
  82. FILE *outf;
  83. object *obj;
  84. {
  85.     if(dowritebinary) {
  86.     putstr(outf,"binarygeom");
  87.     putnewline(outf);
  88.     while(obj) {
  89.         if(dowriteattrs && obj->attr) 
  90.         putattr(outf,obj->attr);
  91.         if(obj->type == OBJ_POINTS) {
  92.         tokentofile(outf,POINT_TOKEN);
  93.         putpoints(outf,obj->points);
  94.         } else if(obj->type == OBJ_LINE) {
  95.         tokentofile(outf,LINE_TOKEN);
  96.         putpoints(outf,obj->points);
  97.         } else if(obj->type == OBJ_LOOP) {
  98.         tokentofile(outf,LOOP_TOKEN);
  99.         putpoints(outf,obj->points);
  100.         } else if(obj->type == OBJ_POLYGON) {
  101.         tokentofile(outf,POLY_TOKEN);
  102.         putpoints(outf,obj->points);
  103.         } else 
  104.         printf("writeobj: blat\n");
  105.         obj = obj->next;
  106.     }
  107.     } else {
  108.     while(obj) {
  109.         if(dowriteattrs && obj->attr) 
  110.         putattr(outf,obj->attr);
  111.         if(obj->type == OBJ_POINTS) {
  112.         putstr(outf,"beginpoints");
  113.         putnewline(outf);
  114.         putpoints(outf,obj->points);
  115.         putstr(outf,"endpoints");
  116.         putnewline(outf);
  117.         } else if(obj->type == OBJ_LINE) {
  118.         putstr(outf,"beginline");
  119.         putnewline(outf);
  120.         putpoints(outf,obj->points);
  121.         putstr(outf,"endline");
  122.         putnewline(outf);
  123.         } else if(obj->type == OBJ_LOOP) {
  124.         putstr(outf,"beginloop");
  125.         putnewline(outf);
  126.         putpoints(outf,obj->points);
  127.         putstr(outf,"endloop");
  128.         putnewline(outf);
  129.         } else if(obj->type == OBJ_POLYGON) {
  130.         putstr(outf,"beginpoly");
  131.         putnewline(outf);
  132.         putpoints(outf,obj->points);
  133.         putstr(outf,"endpoly");
  134.         putnewline(outf);
  135.         } else 
  136.         printf("writeobj: blat\n");
  137.         obj = obj->next;
  138.     }
  139.     }
  140. }
  141.  
  142. putpoints(outf,pnt)
  143. FILE *outf;
  144. point *pnt;
  145. {
  146.     if(dowritebinary) {
  147.     while(pnt) {
  148.         if(dowriteattrs && pnt->attr) 
  149.         putattr(outf,pnt->attr);
  150.         tokentofile(outf,ATTR_TOKEN);
  151.         tofile(outf,&pnt->x,3*sizeof(float));
  152.         pnt = pnt->next;
  153.     }
  154.     } else {
  155.     while(pnt) {
  156.         if(dowriteattrs && pnt->attr) 
  157.         putattr(outf,pnt->attr);
  158.         putstr(outf,"\tpnt");
  159.         putfloat(outf,pnt->x);
  160.         putfloat(outf,pnt->y);
  161.         putfloat(outf,pnt->z);
  162.         putnewline(outf);
  163.         pnt = pnt->next;
  164.     }
  165.     }
  166. }
  167.  
  168. static tofile(outf,data,len)
  169. FILE *outf;
  170. char *data;
  171. int len;
  172. {
  173.     fwrite(data,1,len,outf);
  174. }
  175.  
  176. static tokentofile(outf,token)
  177. FILE *outf;
  178. int token;
  179. {
  180.     fwrite(&token,1,sizeof(int),outf);
  181. }
  182.  
  183. putattr(outf,attr)
  184. FILE *outf;
  185. attribs *attr;
  186. {
  187.     if(dowritebinary) {
  188.     tokentofile(outf,ATTR_TOKEN);
  189.     tofile(outf,attr,6*sizeof(float));
  190.     } else {
  191.     putstr(outf,"\tattr");
  192.     putfloat(outf,attr->r);
  193.     putfloat(outf,attr->g);
  194.     putfloat(outf,attr->b);
  195.     putfloat(outf,attr->nx);
  196.     putfloat(outf,attr->ny);
  197.     putfloat(outf,attr->nz);
  198.     putnewline(outf);
  199.     }
  200. }
  201.  
  202. moveobj(obj,dx,dy,dz)
  203. object *obj;
  204. float dx, dy, dz;
  205. {
  206.     point *pnt;
  207.  
  208.     while(obj) {
  209.     pnt = obj->points;
  210.     while(pnt) {
  211.        pnt->x += dx;
  212.        pnt->y += dy;
  213.        pnt->z += dz;
  214.        pnt = pnt->next;
  215.     }
  216.     obj = obj->next;
  217.     }
  218. }
  219.  
  220. object *newobj()
  221. {
  222.     object *obj;
  223.  
  224.     obj = (object *)mymalloc(sizeof(object));
  225.     obj->next = NULL;
  226.     obj->type = OBJ_LINE;
  227.     obj->attr = NULL;
  228.     obj->points = NULL;
  229.     return obj;
  230. }
  231.  
  232. attribs *newattr()
  233. {
  234.     attribs *attr; 
  235.     attr = (attribs *)mymalloc(sizeof(attribs));
  236.     attr->r = 0.0;
  237.     attr->g = 0.0;
  238.     attr->b = 0.0;
  239.     attr->nx = 0.0;
  240.     attr->ny = 0.0;
  241.     attr->nz = 0.0;
  242. }
  243.  
  244. freeattr(attr)
  245. attribs *attr;
  246. {
  247.     free(attr);
  248. }
  249.  
  250. attribs *cloneattr(attr)
  251. attribs *attr;
  252. {
  253.     attribs *cattr;
  254.  
  255.     cattr = (attribs *)mymalloc(sizeof(attribs));
  256.     *cattr = *attr;
  257.     return cattr;
  258. }
  259.  
  260. point *newpnt(x,y,z)
  261. float x, y, z;
  262. {
  263.     point *pnt;
  264.  
  265.     pnt = pntmalloc();
  266.     pnt->next = NULL;
  267.     pnt->type = PNT_SQUARE;
  268.     pnt->attr = NULL;
  269.     pnt->x = x;
  270.     pnt->y = y;
  271.     pnt->z = z;
  272.     return pnt;
  273. }
  274.  
  275. point *clonepnt(pnt)
  276. point *pnt;
  277. {
  278.     point *cpnt;
  279.  
  280.     cpnt = pntmalloc();
  281.     cpnt->next = NULL;
  282.     cpnt->type = pnt->type;
  283.     if(pnt->attr)
  284.     cpnt->attr = cloneattr(pnt->attr);
  285.     else
  286.     cpnt->attr = NULL;
  287.     cpnt->x = pnt->x;
  288.     cpnt->y = pnt->y;
  289.     cpnt->z = pnt->z;
  290.     return cpnt;
  291. }
  292.  
  293. addpoint(obj,pnt)
  294. object *obj;
  295. point *pnt;
  296. {
  297.     point *cpnt;
  298.  
  299.     pnt->next = NULL;
  300.     if(obj->points) {
  301.     cpnt = obj->points;
  302.     while(cpnt->next)
  303.         cpnt = cpnt->next;
  304.     cpnt->next = pnt;
  305.     } else 
  306.     obj->points = pnt;
  307. }
  308.  
  309. addobject(obj,nobj)
  310. object *obj, *nobj;
  311. {
  312.     object *cobj;
  313.  
  314.     if(obj->next) {
  315.     cobj = obj->next;
  316.     while(cobj->next)
  317.         cobj = cobj->next;
  318.     cobj->next = nobj;
  319.     } else 
  320.     obj->next = nobj;
  321. }
  322.  
  323. freepnts(pnt)
  324. point *pnt;
  325. {
  326.     point *npnt;
  327.  
  328.     while(pnt) {
  329.     npnt = pnt->next;
  330.     if(pnt->attr)
  331.         freeattr(pnt->attr);
  332.     freepnt(pnt);
  333.     pnt = npnt;
  334.     }
  335. }
  336.  
  337. freeobj(obj)
  338. object *obj;
  339. {
  340.     object *nobj;
  341.  
  342.     while(obj) {
  343.     nobj = obj->next;
  344.     freepnts(obj->points);
  345.     if(obj->attr)
  346.         free(obj->attr);
  347.     free(obj);
  348.     obj = nobj;
  349.     }
  350. }
  351.  
  352. object *objfromfile(name)
  353. char *name;
  354. {
  355.     object *obj;
  356.     FILE *inf;
  357.  
  358.     inf = fopen(name,"r");
  359.     if(!inf) {
  360.     fprintf(stderr,"objfromfile: can't open file %s\n",name);
  361.     return 0;
  362.     }
  363.     obj = getobj(inf);
  364.     fclose(inf);
  365.     return obj;
  366. }
  367.  
  368. objtofile(name,obj)
  369. char *name;
  370. object *obj;
  371. {
  372.     FILE *of;
  373.  
  374.     of = fopen(name,"w");
  375.     if(!of) {
  376.     fprintf(stderr,"objtofile: can't open file %s\n",name);
  377.     return 0;
  378.     }
  379.     writeobj(of,obj);
  380.     fclose(of);
  381. }
  382.  
  383. object *getobj(inf)
  384. FILE *inf;
  385. {
  386.     float x, y, z;
  387.     object *objlist;
  388.     object *curobj;
  389.     point *npnt;
  390.     attribs *attr;
  391.     char buf[512];
  392.  
  393.     attr = 0;
  394.     objlist = NULL;
  395.     while(getstr(inf,buf)) {
  396.         if(*buf == 0) {
  397.         ;
  398.         } else if(strcmp(buf,"beginpoly") == 0) {
  399.         getnewline(inf);
  400.         curobj = newobj();
  401.         curobj->type = OBJ_POLYGON;
  402.         curobj->next = objlist;
  403.         curobj->attr = attr;
  404.         objlist = curobj;
  405.         while(getstr(inf,buf)) {
  406.         if(strcmp(buf,"pnt") == 0) {
  407.             x = getfloat(inf);
  408.             y = getfloat(inf);
  409.             z = getfloat(inf);
  410.             getnewline(inf);
  411.             npnt = newpnt(x,y,z);
  412.             npnt->attr = attr;
  413.             addpoint(curobj,npnt);
  414.         } else if(strcmp(buf,"endpoly") == 0) {
  415.             getnewline(inf);
  416.             break;    
  417.         } else if(strcmp(buf,"attr") == 0) {
  418.             attr = newattr();
  419.             attr->r = getfloat(inf);
  420.             attr->g = getfloat(inf);
  421.             attr->b = getfloat(inf);
  422.             attr->nx = getfloat(inf);
  423.             attr->ny = getfloat(inf);
  424.             attr->nz = getfloat(inf);
  425.             getnewline(inf);
  426.         } else 
  427.            printf("getobj: bblat\n");
  428.         }
  429.     } else if(strcmp(buf,"beginline") == 0) {
  430.         getnewline(inf);
  431.         curobj = newobj();
  432.         curobj->type = OBJ_LINE;
  433.         curobj->next = objlist;
  434.         objlist = curobj;
  435.         while(getstr(inf,buf)) {
  436.         if(strcmp(buf,"pnt") == 0) {
  437.             x = getfloat(inf);
  438.             y = getfloat(inf);
  439.             z = getfloat(inf);
  440.             getnewline(inf);
  441.             npnt = newpnt(x,y,z);
  442.             npnt->attr = attr;
  443.             addpoint(curobj,npnt);
  444.         } else if(strcmp(buf,"endline") == 0) {
  445.             getnewline(inf);
  446.             break;    
  447.         } else if(strcmp(buf,"attr") == 0) {
  448.             attr = newattr();
  449.             attr->r = getfloat(inf);
  450.             attr->g = getfloat(inf);
  451.             attr->b = getfloat(inf);
  452.             attr->nx = getfloat(inf);
  453.             attr->ny = getfloat(inf);
  454.             attr->nz = getfloat(inf);
  455.             getnewline(inf);
  456.         } else 
  457.            printf("getobj: bblat\n");
  458.         }
  459.     } else if(strcmp(buf,"beginloop") == 0) {
  460.         getnewline(inf);
  461.         curobj = newobj();
  462.         curobj->type = OBJ_LOOP;
  463.         curobj->next = objlist;
  464.         objlist = curobj;
  465.         while(getstr(inf,buf)) {
  466.         if(strcmp(buf,"pnt") == 0) {
  467.             x = getfloat(inf);
  468.             y = getfloat(inf);
  469.             z = getfloat(inf);
  470.             getnewline(inf);
  471.             npnt = newpnt(x,y,z);
  472.             npnt->attr = attr;
  473.             addpoint(curobj,npnt);
  474.         } else if(strcmp(buf,"endloop") == 0) {
  475.             getnewline(inf);
  476.             break;    
  477.         } else if(strcmp(buf,"attr") == 0) {
  478.             attr = newattr();
  479.             attr->r = getfloat(inf);
  480.             attr->g = getfloat(inf);
  481.             attr->b = getfloat(inf);
  482.             attr->nx = getfloat(inf);
  483.             attr->ny = getfloat(inf);
  484.             attr->nz = getfloat(inf);
  485.             getnewline(inf);
  486.         } else 
  487.            printf("getobj: bblat\n");
  488.         }
  489.     } else if(strcmp(buf,"beginpoints") == 0) {
  490.         getnewline(inf);
  491.         curobj = newobj();
  492.         curobj->type = OBJ_POINTS;
  493.         curobj->next = objlist;
  494.         objlist = curobj;
  495.         while(getstr(inf,buf)) {
  496.         if(strcmp(buf,"pnt") == 0) {
  497.             x = getfloat(inf);
  498.             y = getfloat(inf);
  499.             z = getfloat(inf);
  500.             getnewline(inf);
  501.             npnt = newpnt(x,y,z);
  502.             npnt->attr = attr;
  503.             addpoint(curobj,npnt);
  504.         } else if(strcmp(buf,"endpoints") == 0) {
  505.             getnewline(inf);
  506.             break;    
  507.         } else if(strcmp(buf,"attr") == 0) {
  508.             attr = newattr();
  509.             attr->r = getfloat(inf);
  510.             attr->g = getfloat(inf);
  511.             attr->b = getfloat(inf);
  512.             attr->nx = getfloat(inf);
  513.             attr->ny = getfloat(inf);
  514.             attr->nz = getfloat(inf);
  515.             getnewline(inf);
  516.         } else 
  517.            printf("getobj: bblat\n");
  518.         }
  519.         } else if(strcmp(buf,"attr") == 0) {
  520.         attr = newattr();
  521.         attr->r = getfloat(inf);
  522.         attr->g = getfloat(inf);
  523.         attr->b = getfloat(inf);
  524.         attr->nx = getfloat(inf);
  525.         attr->ny = getfloat(inf);
  526.         attr->nz = getfloat(inf);
  527.         getnewline(inf);
  528.         } else if(strcmp(buf,"binarygeom") == 0) {
  529.         printf("getobj: binary geom\n");
  530.            } else 
  531.         printf("getobj: abalt\n");
  532.     }
  533.     return objlist;
  534. }
  535.  
  536. object *twixtobj(obj1, obj2)
  537. object *obj1, *obj2;
  538. {
  539.     point *pnt1, *pnt2;
  540.     point *next1, *next2;
  541.     object *objlist;
  542.     object *curobj;
  543.     int more;
  544.  
  545.     objlist = curobj = 0;
  546.     while(obj1 && obj2) {
  547.     pnt1 = obj1->points;
  548.     pnt2 = obj2->points;
  549.     while(1) {
  550.         if(obj1->type==OBJ_LINE) {
  551.         if (!(pnt1 && pnt2 && pnt1->next && pnt2->next))
  552.             break;
  553.         } else {
  554.         if (!(pnt1 && pnt2))
  555.             break;
  556.         }
  557.         if(!objlist) {
  558.         objlist = curobj = newobj();
  559.         } else {
  560.         curobj->next = newobj();
  561.         curobj = curobj->next;
  562.         }
  563.         if(obj1->type == OBJ_POINTS)
  564.         curobj->type = OBJ_LINE;
  565.         else
  566.         curobj->type = OBJ_POLYGON;
  567.         next1 = pnt1->next; 
  568.         if(!next1)
  569.         next1 = obj1->points;
  570.         next2 = pnt2->next; 
  571.         if(!next2)
  572.         next2 = obj2->points;
  573.         addpoint(curobj,clonepnt(pnt1));
  574.         addpoint(curobj,clonepnt(pnt2));
  575.         pnt1 = pnt1->next;
  576.         pnt2 = pnt2->next;
  577.         if(obj1->type != OBJ_POINTS) {
  578.         addpoint(curobj,clonepnt(next2));
  579.         addpoint(curobj,clonepnt(next1));
  580.         } 
  581.     }
  582.     obj1 = obj1->next;
  583.     obj2 = obj2->next;
  584.     }
  585.     return objlist;
  586. }
  587.  
  588. applyobj(obj,func)
  589. object *obj;
  590. int (*func)();
  591. {
  592.     point *apnt;
  593.  
  594.     while(obj) {
  595.     apnt = obj->points;
  596.     while(apnt) {
  597.        (func)(apnt);
  598.        apnt = apnt->next;
  599.     }
  600.     obj = obj->next;
  601.     } 
  602. }
  603.  
  604. objdomain(obj,px1,px2,py1,py2,pz1,pz2)
  605. object *obj;
  606. float *px1, *px2;
  607. float *py1, *py2;
  608. float *pz1, *pz2;
  609. {
  610.     point *apnt;
  611.     float x1, x2; 
  612.     float y1, y2; 
  613.     float z1, z2; 
  614.  
  615.     x1 =  1000000.0;
  616.     x2 = -1000000.0;
  617.     y1 =  1000000.0;
  618.     y2 = -1000000.0;
  619.     z1 =  1000000.0;
  620.     z2 = -1000000.0;
  621.  
  622.     while(obj) {
  623.     apnt = obj->points;
  624.     while (apnt) {
  625.        if (apnt->x > x2) x2 = apnt->x;
  626.        if (apnt->x < x1) x1 = apnt->x;
  627.        if (apnt->y > y2) y2 = apnt->y;
  628.        if (apnt->y < y1) y1 = apnt->y;
  629.        if (apnt->z > z2) z2 = apnt->z;
  630.        if (apnt->z < z1) z1 = apnt->z;
  631.        apnt = apnt->next;
  632.     }
  633.     obj = obj->next;
  634.     } 
  635.     *px1 = x1; *px2 = x2;
  636.     *py1 = y1; *py2 = y2;
  637.     *pz1 = z1; *pz2 = z2;
  638. }
  639.  
  640. object *cloneobj(obj)
  641. object *obj;
  642. {
  643.     object *robj, *cobj;
  644.     point *pnt, *cpnt;
  645.  
  646.     cobj = robj = NULL;
  647.     while(obj) {
  648.     if(cobj) {
  649.         cobj->next = newobj();
  650.         cobj = cobj->next;
  651.     } else 
  652.         cobj = robj = newobj();
  653.     cobj->type = obj->type;
  654.     if(obj->points) {
  655.         pnt = obj->points;
  656.         cpnt = clonepnt(pnt);
  657.         cpnt->type = pnt->type;
  658.         cobj->points = cpnt;
  659.         pnt = pnt->next;
  660.         while(pnt) {
  661.             cpnt->next = clonepnt(pnt);
  662.             cpnt = cpnt->next;
  663.             cpnt->type = pnt->type;
  664.             pnt = pnt->next;
  665.         }
  666.     } 
  667.     obj = obj->next;
  668.     }
  669.     return robj;
  670. }
  671.  
  672. evertobj(obj)
  673. object *obj;
  674. {
  675.     point *pntlist, *pnt, *epnt;;
  676.  
  677.     while(obj) {
  678.     if(obj->points) {
  679.         pntlist = pnt = obj->points;
  680.         obj->points = 0;
  681.         while(pnt) {
  682.         epnt = clonepnt(pnt);
  683.         epnt->next = obj->points;
  684.         obj->points = epnt;
  685.         pnt = pnt->next;
  686.         }
  687.         freepnts(pntlist);
  688.     }
  689.     obj = obj->next;
  690.     }
  691. }
  692.  
  693. objstats(obj)
  694. object *obj;
  695. {
  696.     int polys, lines, loops, pointlists, points;
  697.  
  698.     polys = loops = lines = pointlists = points = 0;
  699.     while(obj) {
  700.     if(obj->type == OBJ_POINTS) {
  701.         pointlists++;
  702.         points += pntcount(obj);
  703.     } else if(obj->type == OBJ_LINE) {
  704.         lines++;
  705.         points += pntcount(obj);
  706.     } else if(obj->type == OBJ_LOOP) {
  707.         loops++;
  708.         points += pntcount(obj);
  709.     } else if(obj->type == OBJ_POLYGON) {
  710.         polys++;
  711.         points += pntcount(obj);
  712.     }
  713.     obj = obj->next;
  714.     }
  715.     printf("objstat: %d polys %d loops %d lines %d pntlists. %d tot pnts\n",
  716.                       polys,loops,lines,pointlists,points);
  717. }
  718.  
  719. pntcount(obj)
  720. object *obj;
  721. {
  722.     point *pnt;
  723.     int n;
  724.  
  725.     pnt = obj->points;
  726.     n = 0;
  727.     while(pnt) {
  728.     n++;
  729.         pnt = pnt->next;
  730.     }
  731.     return n;
  732. }
  733.  
  734. stripobj(obj)
  735. object *obj;
  736. {
  737.     point *pnt;
  738.  
  739.     while(obj) {
  740.     if(obj->attr) {
  741.         freeattr(obj->attr);
  742.         obj->attr = 0;
  743.     }
  744.     pnt = obj->points;
  745.     while(pnt) {
  746.         if(pnt->attr) {
  747.         freeattr(pnt->attr);
  748.         pnt->attr = 0;
  749.         }
  750.         pnt = pnt->next;
  751.     }
  752.     obj = obj->next;
  753.     }
  754. }
  755.